var CoinController = require("CoinController");

var PlayerStatUpgradeDisplay = cc.Class({
    extends: cc.Component,

    properties: {
        valueLabel: cc.Label,
		costLabel: cc.Label,

		upgradeButton: cc.Button,
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {

    },

    // update (dt) {},

	updateDisplay(cost, oldValue, newValue) {
		this.valueLabel.string = "Value: " + oldValue + "->" + newValue;
		this.costLabel.string = "Cost: " + cost;

		if (cost <= require("CoinController").instance.currentCoins) {
			this.upgradeButton.interactable = true;
		} else {
			this.upgradeButton.interactable = false;
			this.upgradeButton.enableAutoGrayEffect = true;
		}
	},

	showMaxLevel () {
		this.valueLabel.string = "Max Level";
		this.costLabel.string = "Max Level";
		this.upgradeButton.interactable = false;
		this.upgradeButton.enableAutoGrayEffect = true;
	},
});

module.exports = PlayerStatUpgradeDisplay;